<template>
  <el-form :model="form" ref="form" :rules="rules">
    <!-- <div
      style="
        text-align: center;
        margin-bottom: 2em;
        margin-top: 1em;
        font-weight: bold;
        font-size: 1.5em;
        font-family: 'SimHei';
      "
    >
      修改密码
    </div> -->
    <el-form-item label="旧的密码" prop="oldPassword">
      <el-input type="password" v-model.trim="form.oldPassword"></el-input>
    </el-form-item>
    <el-form-item label="新的密码" prop="password">
      <el-input type="password" v-model.trim="form.password"></el-input>
    </el-form-item>
    <el-form-item label="确认新的密码" prop="passwordConfirm">
      <el-input type="password" v-model.trim="form.passwordConfirm"></el-input>
    </el-form-item>
    <el-form-item style="text-align: right">
      <el-button type="primary" @click="onSubmit" size="mini"
        >提交</el-button
      >
      <el-button @click="resetForm" size="mini">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  props: {
    form: {
      type: Object,
    },
    handleSubmit: {
      type: Function,
    },
    rules: {
      type: Object,
    },
  },
  methods: {
    resetForm() {
      this.$refs.form.resetFields();
    },
    onSubmit() {
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.handleSubmit();
        } else {
          return false;
        }
      });
    },
  },
};
</script>

<style>
</style>